<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

</head>

<body>
    <div id="test"><span>我是一个div</span></div>
    <div id="test2"><span>我是一个div2</span></div>
    <input type="text" id="userName" value="zhangsan">
    <input type="button" value="点击我有惊喜" id="button">

    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.min.js"></script>

    <script>
        $(document).ready(function () {
            $("#button").click(function () {
                let a = $("#test").text("<h1>我是test方法</h1>");
                console.log(a);

                let b = $("#test2").html("<h1>我是html方法</h1>");
                console.log(b);

                let c = $("#userName").val("lisi");
                console.log(c);
            })
        });
    </script>
</body>

</html>